8429b2
@@ -750,7 +750,7 @@
public tableSpec(Hive db, HiveConf conf, ASTNode ast, boolean allowDynamicPartit
         ASTNode partspec = (ASTNode) ast.getChild(1);
         partitions = new ArrayList<Partition>();
         // partSpec is a mapping from partition column name to its value.
-        partSpec = new LinkedHashMap<String, String>(partspec.getChildCount());
+        Map<String, String> tmpPartSpec = new HashMap<String, String>(partspec.getChildCount());
         for (int i = 0; i < partspec.getChildCount(); ++i) {
           ASTNode partspec_val = (ASTNode) partspec.getChild(i);
           String val = null;
@@ -765,15 +765,21 @@
public tableSpec(Hive db, HiveConf conf, ASTNode ast, boolean allowDynamicPartit
           } else { // in the form of T partition (ds="2010-03-03")
             val = stripQuotes(partspec_val.getChild(1).getText());
           }
-          partSpec.put(colName, val);
+          tmpPartSpec.put(colName, val);
         }
 
         // check if the columns, as well as value types in the partition() clause are valid
-        validatePartSpec(tableHandle, partSpec, ast, conf);
+        validatePartSpec(tableHandle, tmpPartSpec, ast, conf);
+
+        List<FieldSchema> parts = tableHandle.getPartitionKeys();
+        partSpec = new LinkedHashMap<String, String>(partspec.getChildCount());
+        for (FieldSchema fs : parts) {
+          String partKey = fs.getName();
+          partSpec.put(partKey, tmpPartSpec.get(partKey));
+        }
 
         // check if the partition spec is valid
         if (numDynParts > 0) {
-          List<FieldSchema> parts = tableHandle.getPartitionKeys();
           int numStaPart = parts.size() - numDynParts;
           if (numStaPart == 0 &&
               conf.getVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE).equalsIgnoreCase("strict")) {
